/**
 * A file change queue.
 */
#ifndef FCQUEUE_H
  #define FCQUEUE_H

  #include "list.h"

  typedef enum {FILE_CHANGED, FILE_NEW, FILE_DELETED} file_change_code;

  typedef struct fcqueue_t
  {
    pthread_mutex_t lock;
    list *queue;
  } fcqueue_t;

  // A representation of a filesystem alteration event.
  typedef struct file_change_t
  {
    file_change_code event;     // The event code.
    char *root;                 // The path being monitored.
    char *path;                 // The path relative to the root of the file that generated the event.
  } file_change_t;


  fcqueue_t *fcqueue_new (void);
  void fcqueue_free (fcqueue_t *);
  void fcqueue_push (fcqueue_t *, file_change_t *);
  file_change_t *fcqueue_pop (fcqueue_t *);
  int fcqueue_has_next (fcqueue_t *);

  file_change_t *file_change_new (file_change_code, char *, char *);
  void file_change_free (file_change_t *);

#endif
